cmake_minimum_required(VERSION 2.8)
project(camera_read)

set(CMAKE_CXX_FLAGS   "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_BUILD_TYPE  Release)

option(WITH_PCL "adds pcl cloud support" ON)
option(WITH_Kinect2 "adds kinect2 support" ON)

if(${WITH_PCL})
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_PCL")
        find_package(PCL 1.8 REQUIRED)
        find_package(PCL REQUIRED)
        link_directories(${PCL_LIBRARY_DIRS})
        add_definitions(${PCL_DEFINITIONS})
        include_directories(${PCL_INCLUDE_DIRS})
endif()

if(${WITH_Kinect2})
    set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
    find_package(Freenect2  REQUIRED)
    include_directories(${FREENECT2_INCLUDE_DIRS})
    include_directories(${INCLUDE})
endif()

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OPENCV_LIBRARY_DIRS})
add_definitions(${OPENCV_DEFINITIONS})


include_directories(include)
add_executable(camera_read
                src/main.cpp
                src/rgbd_xtion.cpp
                src/rgbd_kinect2.cpp)

target_link_libraries(camera_read
  ${FREENECT2_LIBRARY}
  ${OpenCV_LIBRARIES}  
  ${PCL_LIBRARIES}
)
